package com.jason.exp.main;

import java.util.List;
import java.util.concurrent.atomic.LongAdder;

import com.google.common.base.Function;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimaps;
import com.google.common.primitives.Ints;
import com.jason.exp.utils.Identities;
import org.apache.commons.lang3.RandomUtils;

public class TestApp {
	public static void main(String[] args) {
		List<String> theseElements = Lists.newArrayList("alpha", "beta", "gamma");
		theseElements.forEach(System.out::println);

		Iterable<Integer> concatenated = Iterables.concat(Ints.asList(1, 2, 3), Ints.asList(4, 5, 6));
		concatenated.forEach(System.out::println);

		ImmutableSet<String> digits = ImmutableSet.of("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine");
		Function<String, Integer> lengthFunction = new Function<String, Integer>() {
			public Integer apply(String string) {
				return string.length();
			}
		};
		ImmutableListMultimap<Integer, String> digitsByLength = Multimaps.index(digits, lengthFunction);
		System.out.println(digitsByLength);

		System.out.println(Identities.genId());
		System.out.println(RandomUtils.nextInt(1000, 9999));

		LongAdder longAdder = new LongAdder();
		System.out.println(longAdder.intValue());

		Fruit fruit = new Fruit();
		System.out.println(fruit);
	}
}
